#ifndef DRAGO03_DOT_H
#define DRAGO03_DOT_H

#include <cv.h>
#include <cvaux.h>
#include <cxcore.h>
#include <highgui.h>
#include "Common.h"

#define DEBUG_MSG false
#define INVALID_PARAM -1
const float default_ldmax = 100.00f, default_bias = 0.85f, default_exposure = 1.00f, default_gamma_correction = 1.00f;
const float min_ldmax = 1.00f, max_ldmax = 1000.00f;
const float min_bias = 0.50f, max_bias = 1.00f;
const float min_exposure = 0.00f, max_exposure = 40.00f;
const float min_gamma_correction = 0.00f, max_gamma_correction = 5.00f;

class DRAGO03
{
public:
	DRAGO03(float* input, float* lws, float lw_max, int w, int h, ScoreOperator sc);
	~DRAGO03();

	float GetBestParameter(int divide_param, int round_param);
	void SetDefaultParameter();
	void SetParameter(float _lwmax, float _ldmax, float _bias, float _exposure, float _gamma_correction);
	void PrintParameter();
	float GetResult(IplImage *output);
	float GetExposure() { return exposure; };
	static void GetPixelResultGivenExposureAndLwMax(uchar& __r, uchar& __g, uchar& __b, float* fpInput, float __exposure, float __LwMax);

private:
	float GetBestValue(IplImage *img, int div_param, int round_param, float min_value, float max_value, float* __param, float* best_sc);

	int width, height;
	float lwmax, ldmax, bias, exposure, gamma_correction;
	float *input_img, *lw_table;
	ScoreOperator sc_op;
};

#endif